package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConActivityUpload;
import com.htgd.gardenexpo.dao.GeConActivityUploadDao;
import com.htgd.gardenexpo.service.GeConActivityUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConActivityUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-08 13:51:11
 */
@Service("geConActivityUploadService")
public class GeConActivityUploadServiceImpl implements GeConActivityUploadService {
    @Resource
    private GeConActivityUploadDao geConActivityUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConActivityUpload queryById(Integer id) {
        return this.geConActivityUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConActivityUpload> queryAllByLimit(int offset, int limit) {
        return this.geConActivityUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConActivityUpload> queryByActivityId(int activityId) {
        return this.geConActivityUploadDao.queryByActivityId(activityId);
    }

    /**
     * 新增数据
     *
     * @param geConActivityUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConActivityUpload insert(GeConActivityUpload geConActivityUpload) {
        this.geConActivityUploadDao.insert(geConActivityUpload);
        return geConActivityUpload;
    }

    /**
     * 修改数据
     *
     * @param geConActivityUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConActivityUpload update(GeConActivityUpload geConActivityUpload) {
        this.geConActivityUploadDao.update(geConActivityUpload);
        return this.queryById(geConActivityUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConActivityUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByActivityId(Integer id) {
        return this.geConActivityUploadDao.deleteByActivityId(id) > 0;
    }
    @Override
    public boolean deleteByIds(String[] ids,int aid) {
        return this.geConActivityUploadDao.deleteByIds(ids,aid) > 0;
    }
}
